Skip to content

Conversation

@timlee0212
Copy link
Collaborator

@timlee0212 timlee0212 commented Nov 4, 2025

Summary by CodeRabbit

  • Refactor

    • Optimized multi-GPU communication kernel to improve all-reduce performance and better handle edge cases in warp-level computations.
  • Tests

    • Re-enabled previously skipped multi-GPU all-reduce tests to validate kernel improvements.

Description

This PR is trying to fix the accuracy bug encountered in CI, possibly caused by undefined behavior in warp reduce.

The fix is to manually calculate the warp mask and shadow the value if the target lane is outside of the current partial warp scope.

Note: This PR does not need to be cherry-picked into main as #8018 shadows the changes that happen here.

Test Coverage

tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@timlee0212 timlee0212 requested a review from a team as a code owner November 4, 2025 00:39
@timlee0212 timlee0212 marked this pull request as draft November 4, 2025 00:39
@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23432 [ run ] triggered by Bot. Commit: a81a658

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23432 [ run ] completed with state SUCCESS. Commit: a81a658
/LLM/release-1.1/L0_MergeRequest_PR pipeline #391 (Partly Tested) completed with status: 'FAILURE'

@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23469 [ run ] triggered by Bot. Commit: 1524763

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23469 [ run ] completed with state FAILURE. Commit: 1524763
/LLM/release-1.1/L0_MergeRequest_PR pipeline #399 (Partly Tested) completed with status: 'FAILURE'

@timlee0212 timlee0212 force-pushed the rel_1.1_mnnvl_acc_fix branch from 1524763 to 4bdf684 Compare November 4, 2025 07:25
@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23483 [ run ] triggered by Bot. Commit: 4bdf684

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23483 [ run ] completed with state SUCCESS. Commit: 4bdf684
/LLM/release-1.1/L0_MergeRequest_PR pipeline #404 (Partly Tested) completed with status: 'FAILURE'

@timlee0212 timlee0212 force-pushed the rel_1.1_mnnvl_acc_fix branch from 4bdf684 to 0e62b62 Compare November 4, 2025 18:38
@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23534 [ run ] triggered by Bot. Commit: 0e62b62

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23534 [ run ] completed with state SUCCESS. Commit: 0e62b62
/LLM/release-1.1/L0_MergeRequest_PR pipeline #413 (Partly Tested) completed with status: 'FAILURE'

@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23544 [ run ] triggered by Bot. Commit: 0e62b62

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23544 [ run ] completed with state SUCCESS. Commit: 0e62b62
/LLM/release-1.1/L0_MergeRequest_PR pipeline #416 (Partly Tested) completed with status: 'FAILURE'

@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23609 [ run ] triggered by Bot. Commit: 0e62b62

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23609 [ run ] completed with state SUCCESS. Commit: 0e62b62
/LLM/release-1.1/L0_MergeRequest_PR pipeline #428 (Partly Tested) completed with status: 'FAILURE'

@ZhanruiSunCh
Copy link
Collaborator

/bot run --only-multi-gpu-test

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23635 [ run ] triggered by Bot. Commit: 0e62b62

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23635 [ run ] completed with state FAILURE. Commit: 0e62b62
/LLM/release-1.1/L0_MergeRequest_PR pipeline #431 (Partly Tested) completed with status: 'FAILURE'

@timlee0212
Copy link
Collaborator Author

/bot run --only-multi-gpu-test --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23666 [ run ] triggered by Bot. Commit: 0e62b62

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23666 [ run ] completed with state SUCCESS. Commit: 0e62b62
/LLM/release-1.1/L0_MergeRequest_PR pipeline #436 (Partly Tested) completed with status: 'SUCCESS'

@timlee0212 timlee0212 marked this pull request as ready for review November 5, 2025 21:49
@timlee0212
Copy link
Collaborator Author

/bot run --add-multi-gpu-test --disable-fail-fast

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23675 [ run ] triggered by Bot. Commit: 0e62b62

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 5, 2025

📝 Walkthrough

Walkthrough

The PR refactors warp-level reduction functions in the MNVL Allreduce kernel, splitting a single warpReduceSum into two specialized functions (warpReduceSumFull and warpReduceSumPartial) with new lane-addressing constants to properly handle partial warps at block boundaries. Test skip decorators are commented out to allow tests to execute when GPU requirements are satisfied.

Changes

Cohort / File(s) Summary
Warp reduction kernel refactoring
cpp/tensorrt_llm/kernels/communicationKernels/mnnvlTwoShotAllreduceKernels.cu
Replaced single warpReduceSum with warpReduceSumFull (full warps) and warpReduceSumPartial (partial warps). Added constants LOG2_WARP_SIZE and LANE_ID_MASK. Updated block-wide reduction to detect partial warps, compute warp counts using log2-based shifts, and conditionally invoke appropriate warp-reduction function based on warp type.
Test enablement
tests/unittest/_torch/multi_gpu/test_mnnvl_allreduce.py
Commented out unconditional skip decorators in two test locations, allowing tests to run when GPU count requirement (≥2 GPUs) is satisfied.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Kernel logic changes: Verify correctness of partial warp detection, active mask computation, and conditional branching between warpReduceSumFull and warpReduceSumPartial paths.
  • Lane indexing refactoring: Confirm shift- and mask-based calculations (replacing modulo/division) maintain correct lane addressing across all reduction stages.
  • Shared-memory propagation: Validate that results are correctly gathered and propagated in both single-warp and multi-warp scenarios with partial warps.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly describes the main fix: addressing an accuracy issue in MNNVL unit tests on Hopper by fixing undefined behavior in warp reduce operations.
Description check ✅ Passed The PR description clearly explains the bug (undefined behavior in warp reduce), the fix approach (manual warp mask calculation and value shadowing), test coverage (test_mnnvl_allreduce.py), and includes a completed PR checklist.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@tensorrt-cicd
Copy link
Collaborator

PR_Github #23675 [ run ] completed with state SUCCESS. Commit: 0e62b62
/LLM/release-1.1/L0_MergeRequest_PR pipeline #438 completed with status: 'SUCCESS'

@MartinMarciniszyn MartinMarciniszyn merged commit 519eda2 into NVIDIA:release/1.1 Nov 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants